package edu.hrbeu.crc.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import edu.hrbeu.crc.pojo.dto.CategoryAmountDTO;
import edu.hrbeu.crc.pojo.dto.ConsumptionDTO;
import edu.hrbeu.crc.pojo.dto.MonthAmountDTO;
import edu.hrbeu.crc.pojo.dto.MonthConsumptionDTO;
import edu.hrbeu.crc.pojo.entity.Bill;
import edu.hrbeu.crc.pojo.vo.BillPageVO;
import edu.hrbeu.crc.pojo.vo.BillVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface BillMapper extends BaseMapper<Bill> {

    /**
     * 分页查询
     * @param page
     * @param queryWrapper
     * @return
     */
    Page<BillPageVO> selectBillVOPage(Page<BillPageVO> page,
                                      @Param(Constants.WRAPPER) Wrapper<Bill> queryWrapper);

    /**
     * 查询分类对应金额
     * @param userId
     * @param consumptionDTO
     * @return
     */
    List<CategoryAmountDTO> selectCategoryAmount(Integer userId, ConsumptionDTO consumptionDTO);

    /**
     * 查询月份对应金额
     * @param userId
     * @param monthConsumptionDTO
     * @return
     */
    List<MonthAmountDTO> selectMonthAmount(Integer userId, MonthConsumptionDTO monthConsumptionDTO);

    /**
     * 根据用户id，日期限制查询账单
     * @param userId
     * @return
     */
    List<BillVO> selectByUserId(Integer userId, LocalDate startDate, LocalDate endDate);
}
